import {
  BaseEntityInfo,
  QueryEndpointReq,
  QueryInstanceReq,
  QueryServiceReq,
} from './model/commonModel';
import { maintenanceHttp } from '/@/utils/http/axios';

enum Api {
  GET_ALL_SERVICES = '/v1/maintenance/apm/getAllServices',
  GET_ENDPOINTS = '/v1/maintenance/apm/searchEndpoint',
  GET_INSTANCES = '/v1/maintenance/apm/getServiceInstances',
}

export const getAllServices = (params: QueryServiceReq) => {
  return maintenanceHttp.post<BaseEntityInfo[]>({ url: Api.GET_ALL_SERVICES, params });
};

export const getAllEndpoints = (params: QueryEndpointReq) => {
  return maintenanceHttp.post<BaseEntityInfo[]>({ url: Api.GET_ENDPOINTS, params });
};

export const getAllInstances = (params: QueryInstanceReq) => {
  return maintenanceHttp.post<BaseEntityInfo[]>({ url: Api.GET_INSTANCES, params });
};
